import asyncio
import websockets
import json

async def main():
    async with websockets.connect("ws://127.0.0.1:8000") as websocket:
        while True:
            # 等待键盘输入
            action_index = input("请输入action_index: ")
            wav_length = input("请输入wav_length: ")

            # 发送数据
            result = {"action_index": action_index, "wav_length": wav_length}
            await websocket.send(json.dumps(result))

            # 接收回复
            response = await websocket.recv()
            print(f"收到回复: {response}")

if __name__ == "__main__":
    asyncio.run(main())
